Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a script for generating many roxygen-examples-complete tests, apply it #1111

Merged
merged 10 commits into from
Dec 3, 2023

Conversation

MichaelChirico
Copy link
Contributor

Closes #1105. Note that this includes #1110 so the diff is too large for now. I couldn't figure out a way to specify that commit as the diffbase while still creating this PR on r-lib/styler (since that commit is on my fork). Sorry for the visual noise.

@MichaelChirico MichaelChirico changed the title Add a script for generating many roxygen-examples-complete tests, apply it [Merge #1110 first] Add a script for generating many roxygen-examples-complete tests, apply it Apr 7, 2023

for (test in unique_tests) {
out_file <- file.path("tests", "testthat", paste0("test-roxygen-examples-complete-", test, ".R"))
extras <- if (test == "15") ', scope = "spaces"' else ""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid magic string here? What's special about "15"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL

@lorenzwalthert
Copy link
Collaborator

lorenzwalthert commented Apr 18, 2023

#1110 is merged, so I am going to drop this from the title. Feel free to rebase.

@lorenzwalthert lorenzwalthert changed the title [Merge #1110 first] Add a script for generating many roxygen-examples-complete tests, apply it Add a script for generating many roxygen-examples-complete tests, apply it Apr 18, 2023
@lorenzwalthert
Copy link
Collaborator

@IndrajeetPatil since you started to review, I leave this to you.

@lorenzwalthert
Copy link
Collaborator

@MichaelChirico due to #1119, we need to release a new version of {styler} soon (mid next week), just if you want this PR to be included. I don't think we'll have another release soon after that.

@MichaelChirico
Copy link
Contributor Author

Thanks for the ping, feedback handled.

@codecov-commenter
Copy link

codecov-commenter commented May 22, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (2218546) 92.31% compared to head (5ab3a30) 92.31%.
Report is 3 commits behind head on main.

❗ Current head 5ab3a30 differs from pull request most recent head 05c76f4. Consider uploading reports for the commit 05c76f4 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1111   +/-   ##
=======================================
  Coverage   92.31%   92.31%           
=======================================
  Files          46       46           
  Lines        2655     2655           
=======================================
  Hits         2451     2451           
  Misses        204      204           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lorenzwalthert
Copy link
Collaborator

Thanks. @IndrajeetPatil I leave the review to you, only thing I would add is that I am not a big fan of adding a top level directory (albeit hidden) to the repo. Or do we expect future scripts to live in .dev? Can't we just place this script in testthat/? IIRC, files that don't start with test- or helper- are not executed when {testthat} tests are run.

Copy link
Collaborator

@IndrajeetPatil IndrajeetPatil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @MichaelChirico! I like the idea of automating the generation of these test files.

But I agree with Lorenz that it does feel a bit awkward to store the relevant scripts at the top-level of the package directory. I use and see the value of /.dev, but I would use it only for tasks that relate to the entire package (e.g. benchmarking, revdep, etc.). I would instead store the relevant scripts in tests/dev folder.

Does that sound reasonable?

.dev/gen_roxygen_tests.R Outdated Show resolved Hide resolved
@IndrajeetPatil IndrajeetPatil self-requested a review December 3, 2023 15:40
Copy link
Collaborator

@IndrajeetPatil IndrajeetPatil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@IndrajeetPatil
Copy link
Collaborator

IndrajeetPatil commented Dec 3, 2023

The precommit workflow is going to fail until #1158 is merged, and so need to wait for that PR to be merged.

@IndrajeetPatil IndrajeetPatil merged commit d6fee24 into r-lib:main Dec 3, 2023
12 of 15 checks passed
@lorenzwalthert
Copy link
Collaborator

Since we moved the script to generate the tests, some code comments still point to old directory…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Testing] Poor parallelism of test-roxygen-examples-complete.R
4 participants